CPI 200 
HW 3 
due 4-14 midnight

Turn in via Blackboard
Name your file lastname_firstname_HW1.nb

The code below creates and renders a set of points and triangles.

Map them to another set of points and triangles using the matrix 

	(({{1, 0, 1}, {0, 1, 2}, {1, 2, 1}})) .
	
Render the result.

Needs["ComputationalGeometry`"];

(* create memory for (x,y,z) data -- there are  nrc x nrc *)
nrc = 3;
num = nrc^2;
points = Table[{0,0,0},{i,1,num}]//N;

(* domain of x,y is [1,nrc] *)
(* z-value comes from evaluating a function over [-d,d] *)
d = {-2,2};
fct[du_,dv_] := .4du^2+.2dv^2; 
(* fct[du_,dv_] := Sin[du]+dv^2; *)


count = 0;
Do[
(* u in [0,1] *)
u = i/nrc;
(* linear interpolation in domain *)
du = (1-u)*d[[1]] + u*d[[2]];
Do[
(v = j/nrc;
dv = (1-v)*d[[1]] + v*d[[2]];
count = count + 1;
points[[count,1]] = i;
points[[count,2]] = j;
points[[count,3]] =fct[du,dv]),
{j,1,nrc}],
{i,1,nrc}];

Print["points: ",MatrixForm[points]]


TriangularSurfacePlot[points, Lighting->Automatic, Boxed->False]